package event;

import model.Packet;

/**
 * Evento que representa o timeout de um pacote
 * enviado pelo transmissor.
 */
public class ACKTimeoutEvent extends Event {

	Packet pack;
	
	public ACKTimeoutEvent(double time, Packet pack) {
		super(time);
		this.pack = pack;
	}
	
	public Packet getPack() {
		return pack;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((pack == null) ? 0 : pack.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ACKTimeoutEvent other = (ACKTimeoutEvent) obj;
		if (pack == null) {
			if (other.pack != null)
				return false;
		} else if (!pack.equals(other.pack))
			return false;
		return true;
	}

}
